﻿package com.project.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016092900620709"; 
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCrdbc0R1clkaIi2v8f3BkCrRSc0GFxlbZgC0PkmqHTbPWcDuHEn0sln2dNf7T4ctHZbKy6feM5X8bXKXTAlWlKQyTylsmZ7v0TcvgfGjS9w84C2ksup/CrgiA54HIDVu2Sg/yDjn3S+ZITKGgSyVQQMujNfv5CVQJRlUChjWm4IUfE3Rgob4SQMuCbzvXq6TCYoPusGSONfuAcZ97PYvEuKyMhYXM+Lvs+FqMHCIf+G+13cNc/Y/WXtZsy3VaZCsCXIB9TQYNmDacfNQfRTwZ6xkFqKGmOBEBGxx3djqc4iZ5DNytDEK+9A/FF57LprJMemi0V2bJkuuQnp0euRGIzAgMBAAECggEAIxNm0jQR+OaNE7JXZM4i87Ayuk3K0XC+KXHEhty3ZEgzCqTkvNOVjPHKMUmB3R2oHmGkCFa+iDs2s0eQ0eD+9Ck+Qr5kKbCBZ1wqtDopNfT7jQvZO4cxrfRl4VEwIczDtyh3HPameOWDY5XtjIJRRysTAw8KtskrO0NcQHBsgzU9pDvDLjKzIAemtF+Jhy/CedpdtDDo9CRWk+4BWX/TU9Qk7sXQ02AQu52cBH/GqoEZtx/jrgTNyBCQU1yQiduTSNXtqQhzdUP5x7RkwZiNHj/2kuoZcFyHoeijhy1X25Xa6avrLbX1ROzmogtbOhCdr9pCuokDOr1wFVGqLTZMEQKBgQDlkUDMDRaZR3yvu+M42j4Yyy3YbD2CCpQe8bJMRCpJdvtUQORuFWpyZEGWUqFGDCO3txyd9viPD216shu3p4WFIJkS1RbThuuODRoMtOrifa8zzsv3THujSvJPC7XFTn5GMrmsJLzqCTjCZAfUA4aewGO9fDBvxp+hDSaR2Al9GQKBgQC/M63gG+wmjvvVaVvEkxQK9ZbkHMUFLwd/RD8fuA1GlqQFlZD7SKN1+PgEx0XNBjHykpEodl7qoXETxLJY4K1KMjQN+6J1GqlczhZjsRL+kTRd2CUpNfGiEtXBGCLzCxo1iBAu8p4H+0e+uOXcd0ngRYslq5OmVXVQrzJMfqw3KwKBgH+30RH1EiaSxAbNBDxEBxoqJ8ZpacroccHJfAW8Qr5+iJM2SyAHoCImLusf64OaC2ERacVkeqK01ZbWcl85vynymdcFYF6siG6OUXjSSn9Zp1iua4GZNowBjU9211j/M3eAjxX7lnKqUL6tgkFs+L9nj9YCurvlCDhEpbmsNJM5AoGAa53T1NsCfOVnm0PU0fySgGSgjD4hKnzA9IHeIaU/W6a4JSh81OKalnEOb+oVQIOnI0gZibOuUtORSLYiR+IVxzggkmo6kzzxbHnWoj/tV/k0h0l8CQkCut1tEGTcbv2lv9GYgkQubIGjbRa20fMWUrPx0L8UuL9K66HgZqu5lMcCgYBAppZGjBkeXkEIlJwypSReRQQQjU8VoE55+pKo1gV1uaegT6oOM0BQF2hNMXZFgDGEyn4A82coqYHtcAKreVixcnDkNS7ZhQDYVCOdrHbTyUxcTPEHplixBP9BF/FdOcJKVGbONUx8kFQ4HtsmJ3MHwgfCfwg3m8ZCckKqGfyfQQ==";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvAqqDLANCMJeR7a+e9na6wINCxuVA5xJEl6/dPJyKfhidiqY060GMKwQndkQNCT+TCIAvmGiNdgwSo0xq6csq9LQmGPPVbFs/AhV54et+DMBYczW9qt0VY6Ku3K9xxY8RMUp3oS575FGKEJQvX/cbeofI4Ncy5uIo/9IpGQtLqZavv5cZnSp6tmYGIFNoK6tz0cIxJ5yheaY29Swt1L2vvj1DTwN6K638XI0NoXRV4eqypMOTQJY5TE9+iIljOsY07hg/UV6oHIjg+TDEoVi44EO6ezIoTJOZIT1InQTfYRabmueHvQHY9OZF/E9GFsoZH7i6FXe4yI7d4skecp8HQIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://248t4105y5.zicp.vip/ret";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://248t4105y5.zicp.vip/ret_url";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "D:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

